
export const getItem = <T>(key: string): T | null => {
    const data = localStorage.getItem(key)
    if(!data) return null
    try {
        return JSON.parse(data) as T
    // eslint-disable-next-line @typescript-eslint/no-unused-vars
    } catch (err: any) {
        return null
    }
}

export const setItem = (key: string, value: string | null | object) => {
    if(typeof value === 'object'){
        value = JSON.stringify(value)
    }

    localStorage.setItem(key, value)
}

export const removeItem = (key: string) => {
    localStorage.removeItem(key)
}